#include .env

ENVIRONMENT=default
TLS_VERIFY=$(shell docker-machine env $(ENVIRONMENT) | grep 'DOCKER_TLS_VERIFY=".*"' | cut -d\" -f2)
HOST=$(shell docker-machine env $(ENVIRONMENT) | grep 'DOCKER_HOST=".*"' | cut -d\" -f2)
CERT_PATH=$(shell docker-machine env $(ENVIRONMENT) | grep 'DOCKER_CERT_PATH=".*"' | cut -d\" -f2)
MACHINE_NAME=$(shell docker-machine env $(ENVIRONMENT) | grep 'DOCKER_MACHINE_NAME=".*"' | cut -d\" -f2)
export DOCKER_MACHINE_NAME=$(MACHINE_NAME)
export DOCKER_TLS_VERIFY=$(TLS_VERIFY)
export DOCKER_HOST=$(HOST)
export DOCKER_CERT_PATH=$(CERT_PATH)

start:
	@clear
	go build
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test/lan/decent-ft
	cp test/lan/decent-ft test/lan2/decent-ft
	cp decent-ft test/
	mkdir -p test/sample-pool

lan:
	-docker rm decent$N
ifdef N
	docker run -dit --name decent$N -v $$PWD/test:/root/test -p 809$N:8090 dongmingchao/ubuntu
else
	docker run -dit --name decent$N -v $$PWD/test:/root/test -p 8090:8090 dongmingchao/ubuntu
endif
clan:
	docker exec -it decent$N bash
remote:
	scp test/lan/decent-ft root@47.95.192.149:decent/
win:
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o win-decent-ft